package cn.yunbamboos.rest.service.session;

import cn.yunbamboos.rest.service.ISession;
import cn.yunbamboos.rest.service.ISessionContainer;
import org.springframework.stereotype.Component;

/**
 * session容器
 */
public class SessionContainer implements ISessionContainer {

    private final ThreadLocal<ISession> local = new ThreadLocal<>();

    @Override
    public void setSession(ISession session) {
        local.set(session);
    }

    @Override
    public ISession getSession() {
        return local.get();
    }

    @Override
    public void remove(){
        local.remove();
    }

}
